/* -*- C++ -*- */

//=============================================================================
/*
 * @author Feloweria <380374483@qq.com>
 * Copyright (C) Feloweria
 * 
 * $ID 2013-07-14 10:12:05 PM
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * @version 1.0
 */
//=============================================================================

FELOWRIA_BEGIN

inline DateTime::DateTime(const TimeValue time_value)
:year(0),
month(0),
day(0),
week_day(0),
hour(0),
minute(0),
second(0),
micro_second(0),
time(time_value)
{
	 Set(time_value);
}

inline DateTime::DateTime(const int32 year,
							const int32 month,
							const int32 day,
							const int32 week_day,
							const int32 hour,
							const int32 minute,
							const int32 second,
							const int32 micro_second)
:year(year),
month(month),
day(day),
week_day(week_day),
hour(hour),
minute(minute),
second(second),
micro_second(micro_second),
time(0)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline DateTime::DateTime(const DateTime& date_time)
:year(date_time.year),
month(date_time.month),
day(date_time.day),
week_day(date_time.week_day),
hour(date_time.hour),
minute(date_time.minute),
second(date_time.second),
micro_second(date_time.micro_second),
time(date_time.time)
{
	
}

inline DateTime::~DateTime()
{
	
}

inline int32 DateTime::Year() const
{
	return year;
}

inline int32 DateTime::Month() const
{
	return month;
}

inline int32 DateTime::Day() const
{
	return day;
}

inline int32 DateTime::WeekDay() const
{
	return week_day;
}

inline int32 DateTime::Hour() const
{
	return hour;
}

inline int32 DateTime::Minute() const
{
	return minute;
}

inline int32 DateTime::Second() const
{
	return second;
}

inline int32 DateTime::MicroSecond() const
{
	return micro_second;
}

inline void DateTime::Year(int32 year)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::Month(int32 month)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::Day(int32 day)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::Hour(int32 hour)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::Minute(int32 minute) 
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::Second(int32 second)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::MicroSecond(int32 micro_second)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::YearAlter(int32 value)
{
	Set(year + value,month,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::MonthAlter(int32 value)
{
	Set(year,month + value,day,week_day,hour,minute,second,micro_second);
}

inline void DateTime::DayAlter(int32 value)
{
	Set(year,month,day + value,week_day,hour,minute,second,micro_second);
}

inline void DateTime::HourAlter(int32 value)
{
	Set(year,month,day,week_day,hour + value,minute,second,micro_second);
}

inline void DateTime::MinuteAlter(int32 value) 
{
	Set(year,month,day,week_day,hour,value,second,micro_second);
}

inline void DateTime::SecondAlter(int32 value)
{
	Set(year,month,day,week_day,hour,minute,second + value,micro_second);
}

inline void DateTime::MicroSecondAlter(int32 value)
{
	Set(year,month,day,week_day,hour,minute,second,micro_second + value);
}

inline DateTime& DateTime::operator=(const DateTime& date_time)
{
	year = date_time.year;
	month = date_time.month;
	day = date_time.day;
	week_day = date_time.week_day;
	hour = date_time.hour;
	minute = date_time.minute;
	second = date_time.second;
	micro_second = date_time.micro_second;
	
	return *this;
}

inline DateTime& DateTime::operator=(const TimeValue time_value)
{
	Set(time_value);
	
	return *this;
}

inline DateTime& DateTime::operator+=(const DateTime& date_time)
{
	Set(time + date_time.time);
	
	return *this;
}

inline DateTime& DateTime::operator+=(const TimeValue time_value)
{
	Set(time + time_value);
	
	return *this;
}

inline DateTime DateTime::operator+(const DateTime& date_time) const
{
	DateTime result(time + date_time.time);
	
	return result;
}

inline DateTime DateTime::operator+(const TimeValue time_value) const
{
	
	DateTime result(time + time_value);
	
	return result;
}
FELOWRIA_END